#ifndef WG_GENERATOR_HEADER
#define WG_GENERATOR_HEADER

/**
 * Type Definitions and Prototypes for the Workload Generator
 */
#include <stdlib.h>
#include <pthread.h>
#include <sys/time.h>
#include "cJSON.h"
#include "scheduler.h"
#include "resource_model.h"

#define CNT_RESOURCES 5

void setup_generator();

/**
 * translate JSON to a struct the program can easily access
 */
cJSON * parse_config(void);

/**
 * Generates a workload for a specific resource 
 */
int workload_generator(cJSON *, char *, resource_model * (*)(cJSON *), pthread_t *);

/**
 * The controller that schedules a workload. Runs in its own thread.
 */
void * thr_resource(void *);

/**
 * Makes a timeval that represents the point in time some milliseconds from now.
 */
struct timeval *ms_from_now(double);

/**
 * Finds the difference between two points in time in microseconds
 */
unsigned long timeval_diff(struct timeval *, struct timeval *);


#endif
